#ifndef __XKK_TIMER_H__
#define __XKK_TIMER_H__

#include <functional>
namespace xkk
{

class Timer
{
    using TimerCallback=std::function<void()>;

public:
    Timer(TimerCallback && cb,int ,int);

    void start();
    void stop();
private:
    int createTimerfd();
    void handleRead();
    void setTimerfd(int ,int);
private:
    int _fd;
    int _initialTime;
    int _periodicTime;
    TimerCallback _cb;
    int _isStarted;
};

}
#endif
